package com.yckj.test;

import com.yckj.day07.Person;

/**
 * TODO 子类
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/24 11:33
 */
public class Student extends Person {
    private String sid;
    private String cname;
    String sex1;
    protected String sname ="张三";

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public void print(){
        System.out.println(this.name);
    }

    @Override
    public String toString() {
        return "Student{" +
                "sid='" + sid + '\'' +
                ", cname='" + cname + '\'' +
                '}';
    }
    public void study(){
        System.out.println("学习");
    }
    public void play(){
        System.out.println("打游戏");
    }
    public void eat(){
        System.out.println("子类：吃饭");
    }

    public static void main(String[] args) {
         Student student = new Student();
        System.out.println(student.sname); // protected修饰的属性在不同包的子类里可以访问
        System.out.println(student.sex1);
    }
}
